<!DOCTYPE html>
<html>
<head>
    {include file="../application/common/header.html" /}
</head>

<body>
    <table id="exam_youxiaolv_prizedg">
        <thead>
            <tr>
                {volist name="list" id="vo"}
                    <th data-options="field:'{$vo}',sortable:true">{$vo}</th>
                {/volist}
            </tr>
        </thead>
    </table>
    <div id="exam_youxiaolv_prizetb">
        <form id="exam_youxiaolv_prizeForm" class="m5">
            <div>
                学期：
                <select class="easyui-combobox" id="termId" name="termId" data-options="width:120,panelHeight:'auto',value:'请选择', editable:false,textField:'学期名称',valueField:'ID',url:'/compent/Util/termList',onSelect:changeTerm"></select>
                <select id="gradeId" name="gradeId" class="easyui-combobox" data-options="width:80,panelHeight:'auto',url:'/compent/Util/gradeNameList',onSelect:changeGrade"></select>
                <select id="examId" name="examId" class="easyui-combobox" data-options="width:120,panelHeight:'auto',editable:false"></select>
                <select id="type" name="type" class="easyui-combobox" data-options="width:80,editable:false">
                    <option value="0">级排名</option>
                    <option value="1">平均分</option>
                </select>
                <select id="zbType" name="zbType" class="easyui-combobox" data-options="width:100,editable:false">
                    <option value="">请选择</option>
                    <option value="1">第一指标</option>
                    <option value="2">第二指标</option>
                </select>
                <a class="easyui-linkbutton l-btn l-btn-small" data-options="iconCls:'icon-search'" onclick="queryOk('exam_youxiaolv_prize')">查询</a>
                <a class="easyui-linkbutton" href="javascript:void(0)" data-options="iconCls:'icon-save'" onclick="zoutExcel('exam_youxiaolv_prize','/examScore/exam_youxiaolv_prize')">导出为EXCEL</a>
            </div>
        </form>
    </div>
    <script type="text/javascript">
        $(function(){
            var url = "/examScore/exam_youxiaolv_prize";
            initDatagrid("exam_youxiaolv_prize",url);
        })  
        function changeTerm(record){
            var gradeId = $('#gradeId').combobox('getValue');
            if(!gradeId) return;
            var url="/compent/util/getTermExam?termId="+record.ID+"&grade="+gradeId;
            $('#examId').combobox('setValue','');
            $('#examId').combobox('reload',url);
        }
        function changeGrade(record){
            var termId = $('#termId').combobox('getValue');
            if(!termId) return;
            var url="/compent/util/getTermExam?termId="+termId+"&grade="+record.value;
            $('#examId').combobox('setValue','');
            $('#examId').combobox('reload',url);
        }
        function queryOk(cf){
            var termName = $('#termId').combobox('getText');
            var termKey = termName.substr(termName,4);
            var gradeId = $('#gradeId').combobox('getValue');
            var grade = getGrade(termKey,gradeId);
            var examId = $('#examId').combobox('getValue');
            var type = $('#type').combobox('getValue');
            var zbType = $('#zbType').combobox('getValue');
            if(examId){
                if(gradeId==1){
                    $('#'+cf+'dg').datagrid('hideColumn','物理科任').datagrid('hideColumn','物理科前人数')
                    .datagrid('hideColumn','物理科与总都前人数').datagrid('hideColumn','物理有效率');
                    $('#'+cf+'dg').datagrid('hideColumn','化学科任').datagrid('hideColumn','化学科前人数')
                    .datagrid('hideColumn','化学科与总都前人数').datagrid('hideColumn','化学有效率');
                }else if(gradeId == 2) {
                    $('#'+cf+'dg').datagrid('showColumn','物理科任').datagrid('showColumn','物理科前人数')
                    .datagrid('showColumn','物理科与总都前人数').datagrid('showColumn','物理有效率');
                } else {
                    $('#'+cf+'dg').datagrid('showColumn','物理科任').datagrid('showColumn','物理科前人数')
                    .datagrid('showColumn','物理科与总都前人数').datagrid('showColumn','物理有效率');
                    $('#'+cf+'dg').datagrid('showColumn','化学科任').datagrid('showColumn','化学科前人数')
                    .datagrid('showColumn','化学科与总都前人数').datagrid('showColumn','化学有效率');
                }
                $('#'+cf+'dg').datagrid('load',{grade:grade,examId:examId,type:type,zbType:zbType,gradeId:gradeId});
            }else{
                $.messager.alert('操作提示','请选择考试名称和年级。');
            }
        }
        function zoutExcel(cf, url){
            var termName = $('#termId').combobox('getText');
            var termKey = termName.substr(termName,4);
            var gradeId = $('#gradeId').combobox('getValue');
            var grade = getGrade(termKey,gradeId);
            var examId = $('#examId').combobox('getValue');
            var type = $('#type').combobox('getValue');
            var zbType = $('#zbType').combobox('getValue')
            if(examId){
                window.location.href = url+"/exportExcel.html?examId="+examId+"&grade=" + grade+"&gradeId=" + gradeId+"&type="+type+"&zbType="+zbType;
            }else{
                $.messager.alert('操作提示','请选择考试名称和年级。');
                return;
            }
        }
    </script>
</body>
</html>